

"""All the units used in the Soya GUI.

Contains functions like feet(n) (to return a standard value representing n feet)
and inches(n) (same as feet(), but for the inches unit). Also has classes for 
more complex cases, such as the Angle class for degrees/radians.
"""
unitsperfoot = 2.0
#A 2x4 is 80 ldu long, actually 1.25 inches long. The game uses 4 studs per inch
lduperinch = 80
def feet(val):
    """Returns an internal representation of n feet."""
    return val*unitsperfoot

def inches(val):
    """Returns an internal representation of n inches."""
    return (val/12.0)*unitsperfoot

def ldu(val):
    """Returns an internal representation of n LDraw Units (LDU)"""
    return val/(lduperinch*12) * unitsperfoot